package com.exercises;

import com.alibaba.fastjson.JSONObject;

import java.util.Arrays;

//缺失的第一个正数
class Exercise518 {
    public static void main(String[] args) {
        System.out.println(change(8, new int[]{2, 5}));
    }


    public static int change(int amount, int[] coins) {
        Arrays.sort(coins);
        int[] dp = new int[amount + 1];
        dp[0] = 1;

        for (int c : coins) {
            for (int i = c; i <= amount; i++) {
                dp[i] += dp[i - c];
            }
            System.out.println(JSONObject.toJSON(dp));
        }
        return dp[amount];

    }
}
